package com.ljq;

import java.util.ArrayList;

public class RoomSet {
    ArrayList<Room> rooms=new ArrayList<>();

    public void addRoom (Room room) {
        rooms.add(room);
    }


    public Room searchRoomById (String roomId) {
        Room room=null;
        for (Room item : rooms
        ) {
            if (item.getId().equals(roomId)) {  //注意，这里不要用 item.getId()==roomId
                room=item;
                break;//如果发现有该房间号就break
            }
        }
        return room;
    }
}
